package com.yu.shortlink.project.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yu.shortlink.project.dao.entity.ShortLinkDO;
import com.yu.shortlink.project.dto.req.ShortLinkAccessRecordReqDTO;
import com.yu.shortlink.project.dto.req.ShortLinkCreateReqDTO;
import com.yu.shortlink.project.dto.req.ShortLinkPageReqDTO;
import com.yu.shortlink.project.dto.req.ShortLinkUpdateReqDTO;
import com.yu.shortlink.project.dto.resp.ShortLinkCreateRespDTO;
import com.yu.shortlink.project.dto.resp.ShortLinkGroupCountQueryRespDTO;
import com.yu.shortlink.project.dto.resp.ShortLinkPageRespDTO;
import com.yu.shortlink.project.dto.resp.ShortLinkStatsAccessRecordRespDTO;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.util.List;

/**
* @author 哈哈哈呜呜呜
* @description 针对表【t_link】的数据库操作Service
* @createDate 2024-04-23 09:47:04
*/
public interface ShortLinkService extends IService<ShortLinkDO> {
    /**
     * 创建短链接
     */
    ShortLinkCreateRespDTO createShortLink(ShortLinkCreateReqDTO requestParam);

    /**
     * 修改短链接信息
     */
    void updateShortLink(ShortLinkUpdateReqDTO requestParam);

    /**
     * 分页查询短链接
     */
    IPage<ShortLinkPageRespDTO> pageShortLink(ShortLinkPageReqDTO requestParam);

    /**
     *查询短链接分组内的数量
     */
    List<ShortLinkGroupCountQueryRespDTO> listGroupShortLinkCount(List<String> requestParam);


    /**
     * 短链接跳转
     */
    void restoreUrl(String shortUri, HttpServletRequest request, HttpServletResponse response);

    /**
     * 访问单个短链接指定时间内访问记录监控数据
     */
    IPage<ShortLinkStatsAccessRecordRespDTO> shortLinkAccessRecord(ShortLinkAccessRecordReqDTO requestParam);
}
